package com.yswy.theater.vo.res;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yswy.theater.entity.TheaterPlay;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class TheaterPlayResVo {
    @TableId(type = IdType.AUTO)
    private Long id;
    @ApiModelProperty("名字")
    private String playName;
    @ApiModelProperty("简介")
    private String playMsg;
    @ApiModelProperty("图片")
    private String playTitleUrl;
    @ApiModelProperty("类型 0 视频   1 图集")
    private Integer playType;
    @ApiModelProperty("是否有蒙层 1 有  0 没有")
    private Integer isSmegma;
    @ApiModelProperty("点赞数量")
    private Integer likeNum;
    @ApiModelProperty("收藏数量")
    private Integer collectNum;
    @ApiModelProperty("解锁方式")
    private Integer unlockType;
    @ApiModelProperty("观看集数")
    private Integer episodes;
    @ApiModelProperty("总集数")
    private Integer episodesAll;
    @ApiModelProperty("是否收藏")
    private boolean ifCollect;
    @ApiModelProperty("是否可以视频解锁 0 不可以 1 可以")
    private boolean isAdUnlock;
    @ApiModelProperty("解锁金币")
    private Integer unlockSpecies;
    @ApiModelProperty("穿山甲Id")
    private String csjPlayId;
    @ApiModelProperty("资源类型 0 短剧   1 图片   2 小视频  3 穿山甲短剧")
    private Integer zyType;
    public TheaterPlayResVo() {
    }

    public TheaterPlayResVo(TheaterPlay t ,boolean isCollect , Integer episodes ) {
        this.id = t.getId();
        this.playName = t.getPlayName();
        this.playMsg = t.getPlayMsg();
        this.playTitleUrl = t.getPlayTitleUrl();
        this.playType = t.getPlayType();
        this.isSmegma = t.getIsSmegma();
        this.episodes = episodes;
        this.episodesAll = t.getEpisodes();
        this.likeNum =t.getLikeNum();
        this.collectNum = t.getCollectNum();
        this.unlockType = t.getUnlockType();
        this.ifCollect = isCollect;
        this.unlockSpecies = t.getUnlockSpecies();;
        this.isAdUnlock = t.isAdUnlock();
        this.csjPlayId = t.getCsjPlayId();;
        this.zyType = t.getZyType();
    }

    public static List<TheaterPlayResVo> getList(List<TheaterPlay> theaterPlays){
        List<TheaterPlayResVo> list = new ArrayList<>();


        for (TheaterPlay t:theaterPlays) {
            TheaterPlayResVo theaterPlayResVo = new TheaterPlayResVo(t ,false , 1);

            list.add(theaterPlayResVo);
        }
        return list;
    }
}
